package com.example.course.controller;

import com.example.course.entity.SysUser;
import com.example.course.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @author: i_kun
 * @Desc: o_。
 * @create: 2025-06-24 10:25
 */
@RestController
@RequestMapping("sysUser")
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    @GetMapping("/list")
    public List<SysUser> list(){
        List<SysUser> list = sysUserService.list();
        return list;
    }
    @GetMapping("/insert")
    public void insert(){
        SysUser user = new SysUser();
        user.setId(12001L);
        user.setUsername("zhangsan");
        user.setPassword("11111");
        user.setRealName("李四");
        user.setAvatar("0");
        user.setGender(0); // 0-男
        user.setEmail("zhangsan@example.com");
        user.setMobile("13800138000");
        user.setOrgId(10L);
        user.setSuperAdmin(0); // 0-非超级管理员
        user.setStatus(1); // 1-正常
        user.setDeleted(0); // 0-未删除
        user.setCreator("admin");
        user.setCreateTime(new Date());
        user.setUpdater("admin");
        user.setUpdateTime(new Date());
        user.setUpdateTime(new Date());
        user.setUpdateTime(new Date());
        user.setUpdateTime(new Date());
        user.setUpdateTime(new Date());
        sysUserService.save(user);
    }




}
